<#assign base=request.contextPath />
<#assign oneLabel="ERP管理">

<#assign twoLabel="合同管理">
<#assign twoUrl=base+"/suppiler/list">

<#if contractDO?? && (contractDO.id)!=0>
	<#assign leafLabel="编辑合同">
	<#else>
	<#assign leafLabel="新增合同">
</#if>
<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="stylesheet" href="${base}/static/assets/css/chosen.css" />
	<#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" name="formName" method="post">
<#include "/commons/hiddenField.ftl">
<@spring.formHiddenInput "contractDO.id"/>
<div class="row">
	<div class="col-xs-12">
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">
				名称<span class="red">*</span>
			</label>
			<div class="col-sm-3">
				<@spring.formInput "contractDO.projectName" 'class="col-sm-12" AUTOCOMPLETE="off"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.projectName" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">地址</label>
			<div class="col-sm-3">
				<@spring.formInput "contractDO.projectAddress" 'class="col-sm-12" AUTOCOMPLETE="off"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.projectAddress" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">
				总金额<span class="red">*</span>
			</label>
			<div class="col-sm-2">
				<@spring.formInput "contractDO.pageTotalAmount" 'class="col-sm-8" AUTOCOMPLETE="off"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.pageTotalAmount" />
			</div>
		</div>
		<div class="space-4"></div>

        <div class="form-group">
            <label class="col-sm-2 control-label no-padding-right">
				签约日期<span class="red">*</span>
			</label>
            <div class="col-sm-3">
                <div class="row">
                    <div class="col-xs-10">
                        <div class="input-group input-group-sm">
                            <input type="text" readonly="true" class="form-control date-picker"name="signDate" 
                            	value="${(contractDO.signDate?string('yyyy-MM-dd'))!''}" data-date-format="yyyy-mm-dd"/>
                            <span class="input-group-addon"><i class="icon-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="help-block col-xs-12 col-sm-reset inline red">
                <#if contractDO??>
                <@spring.bind "contractDO.signDate" />
                <@spring.showErrors "<br>"/>
                </#if>
            </div>
        </div>
        <div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">生效日期</label>
			<div class="col-sm-3">
				<div class="row">
                    <div class="col-xs-10">
                        <div class="input-group input-group-sm">
                            <input type="text" readonly="true" class="form-control date-picker" name="beginDate" 
                            	value="${(contractDO.beginDate?string('yyyy-MM-dd'))!''}"  data-date-format="yyyy-mm-dd"/>
                            <span class="input-group-addon"><i class="icon-calendar"></i></span>
                        </div>
                    </div>
                </div>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
                <#if contractDO??>
                <@spring.bind "contractDO.beginDate" />
                <@spring.showErrors "<br>"/>
                </#if>
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">结束日期</label>
			<div class="col-sm-3">
				<div class="row">
                    <div class="col-xs-10">
                        <div class="input-group input-group-sm">
                            <input type="text" readonly="true" class="form-control date-picker" name="endDate" 
                            	value="${(contractDO.endDate?string('yyyy-MM-dd'))!''}"  data-date-format="yyyy-mm-dd"/>
                            <span class="input-group-addon"><i class="icon-calendar"></i></span>
                        </div>
                    </div>
                </div>
			</div>
			<div class="help-block col-xs-6 col-sm-reset inline red">
                <#if contractDO??>
                <@spring.bind "contractDO.endDate" />
                <@spring.showErrors "<br>"/>
                </#if>
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">客户公司<span class="red">*</span></label>
			<div class="col-sm-3">
                <select class="col-sm-12 customer-chosen-select" name="customerId" id="customer-select" >
                    <option value="">--请选择--</option>
                </select>
                <input type="hidden" id="customer_id" value="${contractDO.customerId!0}">
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.customerId" />
			</div>
		</div>
		<div class="space-4"></div>
		
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">客户姓名</label>
			<div class="col-sm-3">
				<@spring.formInput "contractDO.customerName" 'class="col-sm-8"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.customerName" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">客户电话</label>
			<div class="col-sm-3">
				<@spring.formInput "contractDO.customerTel" 'class="col-sm-8"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.customerTel" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">业主电话</label>
			<div class="col-sm-3">
				<@spring.formInput "contractDO.owner" 'class="col-sm-8"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.owner" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">
				负责人<span class="red">*</span>
			</label>
			<div class="col-sm-3">
                <select class="col-sm-12 user-chosen-select" name="personLiable" id="user-select" >
                    <option value="">--请选择--</option>
                </select>
                <input type="hidden" id="user_list_id" value="${contractDO.personLiable!''}">
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.personLiable" />
			</div>
		</div>
		<div class="space-4"></div>

		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">进度</label>
			<div class="col-sm-3">
				<@spring.formSingleSelect "contractDO.status" statusMap 'class="col-sm-10 chosen-select"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.status" />
			</div>
		</div>
		<div class="space-4"></div>
	
		<div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">合同内容</label>
			<div class="col-sm-8">
				<@spring.formTextarea "contractDO.content" 'class="col-sm-8" rows="6"'/>
			</div>
			<div class="help-block col-xs-12 col-sm-reset inline red">
				<@spring.showErrors "contractDO.content" />
			</div>
		</div>
		<div class="space-4"></div>
	</div><!-- /.col -->
</div><!-- /.row -->
</form>

<div class="hr hr32 hr-dotted"></div>

<div class="clearfix">
	<div class="col-md-offset-3 col-md-9">
		<button class="btn btn-xs btn-info" type="button" id="save_id"
			url="<#if contractDO??&&contractDO.id!=0>${base}/contract/edit<#else>${base}/contract/add</#if>">
			<i class="icon-save bigger-110"></i>保存
		</button>
		<button class="btn btn-xs return_class" type="button" url="${base}/contract/list">
			<i class="icon-reply bigger-110"></i>返回
		</button>
	</div>
</div>

<#include "/commons/footer.ftl">
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.min.js"></script>
<script src="${base}/static/assets/js/date-time/bootstrap-datepicker.zh-CN.js"></script>
<script src="${base}/static/assets/js/chosen.jquery.min.js"></script>
<script src="${base}/static/js/erp/employee.label.js"></script>
<script src="${base}/static/js/erp/customer.js"></script>
<script src="${base}/static/js/erp/contract.js"></script>
</body>
</html>
